pkgname=mongodb
pkgver=r7.3.0
pkgrel=1
arch=('x86_64' 'aarch64')
url="https://www.mongodb.com/"
pkgdesc="A high-performance, open source, schema-free document-oriented database"
license=('AGPL3')
depends=()
source=("https://github.com/mongodb/mongo.git#tag=$pkgver")
sha256sums=('SKIP')

build()
{
	cd "${srcdir}/mongo"

	python3 -m venv /tmp/venv --prompt mongo
	. /tmp/venv/bin/activate

	python3 -m pip install 'poetry==1.5.1'
	python3 -m poetry install --no-root --sync

	[ "$DISTRO" = "centos" -o "$DISTRO" = "aliyun" ] && {
		source $LKP_SRC/distro/$DISTRO
		install_gcc7
		build_opts="CC=/opt/rh/devtoolset-7/root/usr/bin/gcc CXX=/opt/rh/devtoolset-7/root/usr/bin/g++"
	}

	buildscripts/scons.py install-core --separate-debug --disable-warnings-as-errors -j $(nproc) $build_opts

	deactivate
}

package() {
	mkdir -p "${pkgdir}/lkp/benchmarks/${pkgname}/bin"
	cd "${srcdir}/mongo/build/install/bin"
	cp mongo* "${pkgdir}/lkp/benchmarks/${pkgname}/bin"
}
